//
//  InfoTextView.m
//  小团购
//
//  Created by 樊荣海 on 15/2/9.
//  Copyright (c) 2015年 樊荣海. All rights reserved.
//

#import "InfoTextView.h"

@implementation InfoTextView

+ (id)infoTextView {

    return [[NSBundle mainBundle] loadNibNamed:@"InfoTextView" owner:nil options:nil][0];
}


- (void)setTitle:(NSString *)title {

    _title = title;
    [_titleBtn setTitle:_title forState:UIControlStateNormal];
}

- (void)setIcon:(NSString *)icon {

    _icon = icon;
    [_titleBtn setImage:[UIImage imageNamed:_icon] forState:UIControlStateNormal];
}

- (void)setContent:(NSString *)content {
    _content = content;
    
    [_label setText:_content];
    
    CGFloat newHeight = [LabelTool sizeOfStr:_content andFont:_label.font andMaxSize:CGSizeMake(_label.frame.size.width, 100000) andLineBreakMode:_label.lineBreakMode].height + 10;
    
    //与之前相差多少
    CGFloat daltaH = newHeight-_label.frame.size.height;
    
    //改变 label
    CGRect rect = _label.frame;
    rect.size.height = newHeight;
    _label.frame = rect;
    
    //改变 整体
    CGRect rect2 = self.frame;
    rect2.size.height += daltaH;
    self.frame = rect2;
}



@end
